package cn.myjerry.collection;

import java.util.HashMap;
import java.util.Map;

/**
 * 自定义实现HashSet
 * @author Jerry
 *
 */

public class SxtHashSet {
	
	private Map map;
	private static final Object PRESENT = new Object();
	
	public SxtHashSet(){
		map = new HashMap<>();
	}
	
	public int size() {
		return map.size();
	}
	
	public boolean isEmpty() {
		return map.isEmpty();
	}
	
	public void add(Object obj) {
		map.put(obj, PRESENT);
	}
	
	public static void main(String[] args) {
		SxtHashSet set = new SxtHashSet();
		set.add("111");
		set.add("222");
		set.add("333");
		System.out.println(set.size());
	}
}
